<template id="fu">
  <el-container>
    <el-aside width="215px">
      <div>
        <div style="text-align: center;">
          <h3 style="color: whitesmoke;padding: 7px; ">{{this.moduleName}}</h3>
        </div>
        <div   width="205px"  style="width: 200px; height: 525px;margin-top: 1px;  overflow: auto;margin-left: 12px; background-color: white;border-radius: 7px;">
          <!-- background-color: #6D7173; -->
          <el-tree   :data="data" node-key="mid" :props="defaultProps" @node-click="handleNodeClick"
            style="background-color: white; margin-top: 7px; color: #000000; font-size: 14px;" ref="tree">
            <span class="custom-tree-node " slot-scope="{node,data }">
              <span>
                <i :class="data.icon"></i>{{ node.label }}
              </span>
            </span>
          </el-tree>
        </div>
      </div>
    </el-aside>

    <el-container>
      <el-main>
        <!-- style="position: absolute;left: 224px;" -->
        <el-breadcrumb separator="el-icon-arrow-right">
          <el-breadcrumb-item><span style="color:white; font-size: 16px;">{{breadLabel}}</span></el-breadcrumb-item>
        </el-breadcrumb>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  export default {
    inject:['reload'],
    name: 'repertory',
    data() {
      return {
        breadList: [],
        breadLabel: "",
        moduleName:'暂无标题',
        data: [{
          label: '客户化设置',
          // icon: 'el-icon-notebook-2',
          children: [{
              label: '库房设置',
              // icon: 'el-icon-notebook-2',
              children: [{
                label: '库房属性设置',
                herf: '/main/rep/repattr'
                // icon: 'el-icon-notebook-2'
              }]
            },
            {
              label: '出入库理设置',
              // icon: 'el-icon-notebook-2',
              children: [{
                label: '出入库理设置',
                herf: '/main/rep/repinitset'
                // icon: 'el-icon-notebook-2'
              }]
            },
            {
              label: '库存地址分配设置',
              // icon: 'el-icon-notebook-2',
              children: [{
                  label: 'I级产品',
                  herf: '/main/rep/repI'
                  // icon: 'el-icon-notebook-2'
                },
                {
                  label: 'II级产品',
                  herf: '/main/rep/repII'
                  // icon: 'el-icon-notebook-2'
                },
                {
                  label: 'III级产品',
                  herf: '/main/rep/repIII'
                  // icon: 'el-icon-notebook-2'
                }
              ]
            }
          ]
        }, {
          label: '安全库存配置管理',
          children: [{
              label: '制定安全库存配置单',
              herf: '/main/rep/repset'
              // icon: 'el-icon-notebook-2'
            }, {
              label: '安全库存配置单复核',
              herf: '/main/rep/repsh'
              // icon: 'el-icon-notebook-2'
            }, {
              label: '安全库存配置单查询',
              herf: '/main/rep/repsel'
              // icon: 'el-icon-notebook-2'
            },
            {
              label: '安全库存配置单变更',
              herf: '/main/rep/repchange'
              // icon: 'el-icon-notebook-2'
            }
          ]
        }, {
          label: '入库申请管理',
          icon: 'el-icon-notebook-2',
          children: [{
            label: '入库申请登记',
            herf: '/main/rep/repinit'
            // icon: 'el-icon-notebook-2'
          }, {
            label: '入库申请登记审核',
            herf: '/main/rep/repinitsh'
          }, {
            label: '入库申请查询',
            herf: '/main/rep/repinitsel'
          }]
        }, {
          label: '出库申请管理',
          children: [{
            label: '出库申请登记',
            herf: '/main/rep/repout'
          }, {
            label: '出库申请登记审核',
            herf: '/main/rep/repoutsh'
          }, {
            label: '出库申请查询',
            herf: '/main/rep/repoutsel'
          }]
        }, {
          label: '内部调入申请管理',
          children: [{
            label: '内部调入申请登记',
            herf: '/main/rep/repioinit'
          }, {
            label: '内部调入申请登记审核',
            herf: '/main/rep/repioinitsh'
          }, {
            label: '内部调入申请审核',
            herf: '/main/rep/repioinitsel'
          }]
        }, {
          label: '内部调出申请管理',
          children: [{
            label: '内部调出申请登记',
            herf: '/main/rep/repioout'
          }, {
            label: '内部调出申请登记审核',
            herf: '/main/rep/repiooutsh'
          }, {
            label: '内部调出申请审核',
            herf: '/main/rep/repiooutsel'
          }]
        }, {
          label: '出入库调度管理',
          children: [{
            label: '制定入库单',
            herf: '/main/rep/repinitunit'
          }, {
            label: '制定出库单',
            herf: '/main/rep/repoutunit'
          }]
        }, {
          label: '入库管理',
          children: [{
            label: '入库登记',
            herf: '/main/rep/repinitreg'
          }, {
            label: '入库登记复核',
            herf: '/main/rep/repinitregsh'
          }, {
            label: '入库查询',
            herf: '/main/rep/repinitregsel'
          }]
        }, {
          label: '出库管理',
          children: [{
            label: '出库登记',
            herf: '/main/rep/repoutreg'
          }, {
            label: '出库登记复核',
            herf: '/main/rep/repoutregsh'
          }, {
            label: '出库查询',
            herf: '/main/rep/repoutregsel'
          }]
        }, {
          label: '动态库存管理',
          children: [{
            label: '动态库存查询',
            herf: '/main/rep/repselect'
          }, {
            label: '出入库明细查询',
            herf: '/main/rep/repchuru'
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }

      }
    },
    methods: {
      handleNodeClick(data) {
        //获取面包屑
        if (data.herf) {
          this.breadList = [];
          this.getTreeNode(this.$refs.tree.getNode(data.mid));
          // this.reload();
          this.$router.push(data.herf);
        }
      },
      getMoudels() {
        var moduleName = this.$route.query.params;
        this.$http.post('system/module/getModule?moduleName=' + moduleName).then(res => {
          this.data = [];
          this.data = res.data;
        }).catch(err => {
          console.log(err);
        })
      },
      //获取当前树节点和其父级节点
      getTreeNode(node) {
        if (node && node.label) {
          this.breadList.unshift(node.label);
          this.getTreeNode(node.parent); //递归
          this.breadLabel = this.breadList.join("/");
        }
      }
    },
    mounted() {
    this.moduleName = this.$route.query.params;
      this.getMoudels();
    }
  }
</script>

<style scoped="scoped">
  * {
    padding: 0px;
    margin: 0px;
  }

  .el-aside {

    text-align: center;
    /* background-color: #6D7173; */
    background-color: #333333;
    height: 574px;
  }

  .el-main {

    padding: 10px;
    /* background-color: #6D7173 */;
    background-color: #333333;
    color: #333;
    text-align: center;
    /* overflow: hidden; */
    height: 574px;

  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
